/*
package thread;

import org.junit.Test;
import org.junit.experimental.theories.suppliers.TestedOn;

import java.util.concurrent.locks.ReentrantLock;

*/
/**
 * @author zhangxin
 * @date 2020/9/23
 *//*

public class ThreadTest {

    public static void main(String[] args) {


        Thread thread1 = new Thread(() -> {
            //try {
            //throw new RuntimeException("java");
            //
            //}finally {
            //    System.out.println(Thread.interrupted());
            //}
            Thread.currentThread().interrupt();
            if (Thread.currentThread().isInterrupted()) {
                System.out.println("isInterrupted");
            }

            try {
                System.out.println("sleep");
                Thread.sleep(3000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        });


        new Thread(() -> {

            System.out.println("Java2");
        }).start();

        thread1.start();
        try {
            thread1.join();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

        System.out.println("finish");

    }

    @Test
    public void testYield() {

        System.out.printf("AA");
        Thread.yield();

        System.out.printf("VB");

    }

    @Test
    public void interrupted() throws InterruptedException {
        ReentrantLock reentrantLock = new ReentrantLock();

        Thread thread = new Thread(() -> {
       */
/*     try {
                reentrantLock.lockInterruptibly();
            } catch (InterruptedException e) {
                e.printStackTrace();
            }*//*



            reentrantLock.lock();

            reentrantLock.unlock();

        }, "1");

        thread.interrupt();


        Thread getLockSuccess = new Thread(() -> {
            reentrantLock.lock();
            System.out.println("get lock success");
            reentrantLock.unlock();
            try {
                Thread.sleep(2000L);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }

        }, "2");

        thread.start();
        getLockSuccess.start();


        thread.join();
        getLockSuccess.join();
    }

    @Test
    public void print() throws InterruptedException {
        String current = "A";
        PrintThread a = new PrintThread("A");
        PrintThread b = new PrintThread("B");
        PrintThread c = new PrintThread("C");

        a.setNextThread(b);
        a.start();

        b.setNextThread(c);
        b.start();

        c.setNextThread(a);
        c.start();

        a.running = true;
        b.running = true;
        c.running = true;

        Thread.sleep(30000L);
    }
}
*/
